using ApiTest.Api.Entity;
using Microsoft.EntityFrameworkCore;

namespace ApiTest.Api.Db
{
    
    public class DbInit : DbContext
    { 
        /// <summary>
        /// 采用依赖注入的方式的时，必须提供其构造函数，并且调用其父类构造函数
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public DbInit(DbContextOptions options) : base(options)
        {

        }

        public DbSet<Users>users{get;set;}
        public DbSet<Roles>roles{get;set;}
        public DbSet<UserRoles>userRoles{get;set;}

        protected override void OnConfiguring(DbContextOptionsBuilder options)
        { 
            
            options.UseSqlServer(@"server=.;database=DbInit;uid=sa;pwd=123456;");
        }
    }
}